﻿function artDialogForm(URL, title, id, w, h, method) {
    if (!id) id = 'default';
    if (!w) w = $(window).width()/2;
    if (!h) h = $(window).height()/2;

    method = (!method) ? window.top.art.dialog.open : art.dialog.open;
    method(URL, {
        id: id,
        title: title,
        width: w,
        height: h,
        dblclick_hide:false,
        lock: true,
        opacity: 0.2,
        background: '#fafafa'
        //init: function () {
        //    $(".aui_footer").parent().hide();
        //},
        //close: function () { $(".aui_footer").parent().show(); }
    });
}

function artDialogFormWithCallback(Url,title, id, w, h,oninit,onclose, method) {
    if (!id) id = 'default';
    if (!w) w = $(window).width() / 2;
    if (!h) h = $(window).height() / 2;

    method = (!method) ? window.top.art.dialog.open : art.dialog.open;
    var myDialog = method(Url,
        {
            id: id,
            title: title,
            width: w,
            height: h,
            dblclick_hide: false,
            lock: true,
            opacity: 0.2,
            background: '#fafafa',
            init: function () {
                //$(".aui_footer").parent().hide();
                if (oninit != null) {
                    oninit();
                }
            },
            close: function () {
                //$(".aui_footer").parent().show();
                if (onclose != null) {
                    onclose();
                }
            }
        });
}


function artDialogAlert(_content) {
    window.top.art.dialog({
        lock: true,
        time: 3,
        opacity: 0.2,
        background: '#fafafa',
        content: '<div style="text-align:center;">' + _content + '</div>',
        okVal: '确定',
        ok: function () { return true; },
        cancel: false
    });
}

function artDialogConfirm(_content, yescallback, nocallback) {
    window.top.art.dialog.confirm('<div style="text-align:center;">' + _content + '</div>', yescallback);
}

//删除提示
function artDialogDeleteConfirm(id, url, msg) {
    if (!msg)
        msg = '确定要删除？';
    window.top.art.dialog.confirm(msg, function () {
        $.getJSON(url, { id: id }, function (data) {
            window.top.art.dialog.tips('<span style="color:#f00">' + data.info + '</span>', 1);
            if (data.status == 1)
                $('#list-' + id).remove();
        });
    });
}